//
//  MTMeViewController.m
//  ShiShiBang
//
//  Created by 宋宝强 on 16/9/22.
//  Copyright © 2016年 motianjituan. All rights reserved.
//

#import "MTMeViewController.h"
#import "MTArrowItem.h"
#import "MTSettingGroupItem.h"
#import "MTMineHeadView.h"
#import "MTBigViewController.h"
#import "MTMyPhotoViewController.h"
#import "MTCollectionViewController.h"
#import "MTSettingViewController.h"
#import "MTDetailPersonCell.h"
#import "MTProfileViewController.h"
#import "MTControllerNotiViewController.h"
#import "MTRecomdAppViewController.h"
#import "MTTFProfileController.h"
#import "MTShareFriendViewController.h"
#import "MTFeedBackViewController.h"
#import "MTFavoriteViewController.h"

@interface MTMeViewController ()
@property (nonatomic, strong) MTDetailPersonCell *cell;
@end

@implementation MTMeViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self initNavigation];
    [self setUpGroup4];
    [self setUpGroup0];
    [self setUpGroup1];
    [self setUpGroup2];
    [self setUpGroup3];
    

    self.tableView.sectionHeaderHeight = 10;
    self.tableView.sectionFooterHeight = 0;

    self.tableView.contentInset = UIEdgeInsetsMake(65, 0, 0, 0);
}


//导航栏内容设置
-(void)initNavigation {
    
    self.navigationItem.title = @"我";
    
    self.navigationItem.rightBarButtonItem = [UIBarButtonItem itemWithImage:[UIImage imageNamed:@"setting_btn-set-default"] highImage:[UIImage imageNamed:@"setting_btn-set-default"] target:self action:@selector(clickSettingBtn)];
    
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithColor:UIColorFromRGB(0x45c75a)]  forBarMetrics:UIBarMetricsDefault];
    NSMutableDictionary *attr = [NSMutableDictionary dictionary];
    attr[NSFontAttributeName] = [UIFont boldSystemFontOfSize:17];
    attr[NSForegroundColorAttributeName] = [UIColor whiteColor];
    [self.navigationController.navigationBar setTitleTextAttributes:attr];
    
}

#pragma mark -点击设置按钮
- (void)clickSettingBtn {
    
    MTSettingViewController *settingVC = [[MTSettingViewController alloc] init];
    [self.navigationController pushViewController:settingVC animated:YES];
}

- (void)setUpGroup0 {
    MTArrowItem  *item0 = [MTArrowItem itemWithImage:[UIImage imageNamed:@"setting_icon-account"] title:@"个人主页"];
    item0.desClass = [MTTFProfileController class];
    
    NSArray *array =  @[item0];
    MTSettingGroupItem *groupItem = [MTSettingGroupItem settingGroupItemWithRowArray:array headerT:nil footerT:nil];
    [self.groupArray addObject:groupItem];
}

- (void)setUpGroup1 {
    MTArrowItem  *item0 = [MTArrowItem itemWithImage:[UIImage imageNamed:@"setting_remmond"] title:@"推荐应用"];
    item0.desClass = [MTRecomdAppViewController class];
    NSArray *array =  @[item0];

    MTSettingGroupItem *groupItem = [MTSettingGroupItem settingGroupItemWithRowArray:array headerT:nil footerT:nil];
    [self.groupArray addObject:groupItem];
}

- (void)setUpGroup2 {
    MTArrowItem  *item0 = [MTArrowItem itemWithImage:[UIImage imageNamed:@"setting_icon-collection"] title:@"我的收藏"];
    item0.desClass = [MTFavoriteViewController class];
    
    MTArrowItem *item1 = [MTArrowItem itemWithImage:[UIImage imageNamed:@"setting_icon-invitation"] title:@"邀请好友"];
    item1.desClass = [MTShareFriendViewController class];
    
    MTArrowItem *item2 = [MTArrowItem itemWithImage:[UIImage imageNamed:@"setting_icon-control"] title:@"控制中心"];
    item2.desClass = [MTControllerNotiViewController class];
    
  
    NSArray *array =  @[item0,item1,item2];
    MTSettingGroupItem *groupItem = [MTSettingGroupItem settingGroupItemWithRowArray:array headerT:nil footerT:nil];
    [self.groupArray addObject:groupItem];
}

- (void)setUpGroup3 {
    MTArrowItem  *item0 = [MTArrowItem itemWithImage:[UIImage imageNamed:@"setting_icon-account"] title:@"反馈与帮助"];
     item0.desClass = [MTFeedBackViewController class];
    
    NSArray *array =  @[item0];
    MTSettingGroupItem *groupItem = [MTSettingGroupItem settingGroupItemWithRowArray:array headerT:nil footerT:nil];
    [self.groupArray addObject:groupItem];
}

- (void)setUpGroup4 {
    MTDetailPersonCell *cell = [MTDetailPersonCell loadxib];
    _cell = cell;
    [self.tableView addSubview: cell];
}


- (void)viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];
    _cell.frame = CGRectMake(0, -55, MTScreenW, 80);
}


@end

